package com.ruoyi.system.service.impl;

import java.util.List;

import com.ruoyi.system.domain.ZhwyDowntown;
import com.ruoyi.system.mapper.ZhwyDowntownMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.ZhwyBuildingMapper;
import com.ruoyi.system.domain.ZhwyBuilding;
import com.ruoyi.system.service.IZhwyBuildingService;

/**
 * 楼栋信息管理Service业务层处理
 * 
 * @author nhh
 * @date 2024-05-04
 */
@Service
public class ZhwyBuildingServiceImpl implements IZhwyBuildingService 
{
    @Autowired
    private ZhwyBuildingMapper zhwyBuildingMapper;
    @Autowired
    private ZhwyDowntownMapper zhwyDowntownMapper;

    @Override
    public int del(Long[] ids) {
        return zhwyBuildingMapper.del(ids);
    }

    @Override
    public int canceldel(Long id) {
        return zhwyBuildingMapper.canceldel(id);
    }

    /**
     * 查询楼栋信息管理
     * 
     * @param id 楼栋信息管理主键
     * @return 楼栋信息管理
     */
    @Override
    public ZhwyBuilding selectZhwyBuildingById(Long id)
    {
        return zhwyBuildingMapper.selectZhwyBuildingById(id);
    }

    /**
     * 查询楼栋信息管理列表
     * 
     * @param zhwyBuilding 楼栋信息管理
     * @return 楼栋信息管理
     */
    @Override
    public List<ZhwyBuilding> selectZhwyBuildingList(ZhwyBuilding zhwyBuilding)
    {
        List<ZhwyBuilding> zhwyBuildings = zhwyBuildingMapper.selectZhwyBuildingList(zhwyBuilding);
        for (ZhwyBuilding zhwyBuilding1 : zhwyBuildings) {
            ZhwyDowntown zhwyDowntown = zhwyDowntownMapper.selectZhwyDowntownById(zhwyBuilding1.getdId());
            zhwyBuilding1.setDtname(zhwyDowntown.getName());
        }

        return zhwyBuildings;
    }

    /**
     * 新增楼栋信息管理
     * 
     * @param zhwyBuilding 楼栋信息管理
     * @return 结果
     */
    @Override
    public int insertZhwyBuilding(ZhwyBuilding zhwyBuilding)
    {
        return zhwyBuildingMapper.insertZhwyBuilding(zhwyBuilding);
    }

    /**
     * 修改楼栋信息管理
     * 
     * @param zhwyBuilding 楼栋信息管理
     * @return 结果
     */
    @Override
    public int updateZhwyBuilding(ZhwyBuilding zhwyBuilding)
    {
        return zhwyBuildingMapper.updateZhwyBuilding(zhwyBuilding);
    }

    /**
     * 批量删除楼栋信息管理
     * 
     * @param ids 需要删除的楼栋信息管理主键
     * @return 结果
     */
    @Override
    public int deleteZhwyBuildingByIds(Long[] ids)
    {
        return zhwyBuildingMapper.deleteZhwyBuildingByIds(ids);
    }

    /**
     * 删除楼栋信息管理信息
     * 
     * @param id 楼栋信息管理主键
     * @return 结果
     */
    @Override
    public int deleteZhwyBuildingById(Long id)
    {
        return zhwyBuildingMapper.deleteZhwyBuildingById(id);
    }
}
